package router

import (
	"github.com/gin-gonic/gin"
	"im/middlewares"
	"im/service"
)

func Router() *gin.Engine {
	r := gin.Default()
	//用户登陆
	r.POST("/sendcode", service.SendCode)
	r.POST("/register", service.Register)
	// 用户验证组
	auth := r.Group("/auth", middlewares.AuthCheck())
	// 用户登陆
	auth.POST("/login", service.Login)
	// 查询用户个人信息
	auth.GET("/user/query", service.UserQuery)
	// 发送、接受信息
	auth.GET("/websocket/message", service.WebSocketMessage)
	// 聊天记录列表
	auth.GET("/user/detail", service.UserDetails)
	// 聊天记录
	auth.GET("chat/list", service.ChatList)
	// 添加、删除好友
	auth.POST("/user/add", service.UserAdd)
	auth.DELETE("user/delete", service.UserDelete)
	return r
}
